#include <AVUITileBrush.h>

namespace AVUI {

class BitmapImage;

class ImageBrush : public TileBrush
{
public:

    DECLARE_ELEMENT(ImageBrush, TileBrush);

    ImageBrush() : m_pBitmapImage(NULL) { }

    void set_ActiveBrush(Renderer* pRenderer);

    DECLARE_DEPENDENCY_PROPERTY(ImageSource);
    TRefCountedPtr<BitmapImage> get_ImageSource() { return (BitmapImage*)(Object*)GetValue(get_ImageSourceProperty()); }
    void set_ImageSource(BitmapImage* pValue) { return SetValue(get_ImageSourceProperty(), (Object*)pValue); }

    float get_NaturalWidth();
    float get_NaturalHeight();

protected:
    virtual TRefCountedPtr<Freezable> CreateInstanceCore() AVUI_OVERRIDE { return object_allocate<ImageBrush>().get_Ptr(); }

private:
    static void StaticConstructor();
    static void ImageSourcePropertyChanged(DependencyObject* pDO, DependencyPropertyChangedEventArgs* e);

    BitmapImage* m_pBitmapImage;
};



}; // namespace AVUI
